fix(server): treat slow az --version as present, not missing (#4) - #10
Merged
Conversation
The source-control discovery probe hard-capped the CLI version probe at 5s and mapped every failure — including a timeout — to `status: "missing"`, which rendered the "install az" hint and skipped the fast auth check. On Windows `az --version` routinely takes 6-8s (Python startup + the Azure CLI "updates available" check), so an installed, authenticated Azure CLI was reported "not available". - Raise the discovery CLI probe timeout from 5s to 15s (CLI_PROBE_TIMEOUT_MS). - Branch probeCli's error handler on the cause tag: only VcsProcessSpawnError (ENOENT) => "missing" + install hint. A timeout (or other runtime failure) => "available", so probeSourceControlProvider still runs the fast `az account show` auth probe instead of short-circuiting. Adds SourceControlProviderDiscovery.test.ts covering: timeout => available + auth runs, spawn error => missing + auth skipped, the raised timeout, and timeout + unauthenticated. Fixes #4 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Address review nit: the "all non-spawn errors => available" branch was only exercised via VcsProcessTimeoutError. Add a case where `--version` fails with a non-zero exit (VcsProcessExitError) and assert the provider stays available and the auth probe still runs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4. On Windows the Azure DevOps connector reported "not available" with the install
azhint even when the Azure CLI was installed, on PATH, and authenticated.Root cause: the source-control discovery probe hard-coded a 5s timeout on
az --versionand its catch-all mapped every failure — including aVcsProcessTimeoutError— tostatus: "missing", which rendered the install hint and short-circuited the fast (~1s)az account showauth check.az --versionon Windows routinely takes 6–8s (Python startup + the Azure CLI "updates available" check), so a present-but-slow CLI was misclassified as missing.Changes (
apps/server/src/sourceControl/SourceControlProviderDiscovery.ts)timeoutMs: 5_000values with a namedCLI_PROBE_TIMEOUT_MS = 15_000(well above the observed 6–8s tail; still below the module's 30s default).probeCli's error handler now branches on the cause tag — onlyVcsProcessSpawnError(ENOENT / genuine spawn failure) →status: "missing"+ install hint. A timeout (or any other runtime failure) →status: "available", soprobeSourceControlProviderstill runs the fastaz account showauth probe instead of short-circuiting.No contract change —
SourceControlDiscoveryStatusstays"available" | "missing"; a slow-but-present CLI resolves through the existing "available" + auth path, which the desktop Settings UI already renders as "Authenticated as …".Tests (new
SourceControlProviderDiscovery.test.ts)TDD — written to fail first, then made green. Drives the exported
probeSourceControlProviderwith a capturing mockVcsProcess:--versiontimes out + auth succeeds →available+authenticated, and theaz account showprobe actually runs. (red before fix)--versionspawn error (ENOENT) →missing+unknown, auth probe not attempted. (regression guard)--versionprobetimeoutMs >= 15000, version parsed,available+authenticated. (red before fix)--versiontimes out +account showexits non-zero →available+unauthenticated.Verification
vp test run src/sourceControl/→ 13 files / 94 tests passtsgo --noEmit→ clean (exit 0)vp fmt --check+ lint on changed files → clean🤖 Generated with Claude Code